package com.alex.service.impl;

import com.alex.dao.UserMapper;
import com.alex.pojo.User;
import com.alex.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;

public class UserServiceImpl {

    public boolean userExist(String username, String password) {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        User user = mapper.queryUser(username, password);
        return user != null;
    }

    public User getUser(String username, String password) {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        User user = mapper.queryUser(username, password);
        return user;
    }
}
